package com.niit.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Game {

    @Autowired
    private  Audio audio;

//    @Autowired // 自动注入
//    public void setAudio(Audio audio) {
//        this.audio = audio;
//    }

    public void play() {
        audio.play(); // 播放声音
        System.out.println("Playing game");
    }
}
